<?php
 // the link that may open the dialog
echo CHtml::link(Yii::t('main','New Pay'), array('payment/create','user_id'=>$model->user_id), array(
	//'onclick'=>'$("#payment-dialog").dialog("open"); return false;',
));

//$this->widget('Dialog', array(
//	'id'=>'payment-dialog',
//	'div'=>'paymentForm',
//	'url'=>$this->createUrl('payment/create',array('user_id'=>$model->user_id)),
//	'options'=>array(
//		'title'=>'Create Payment',
//		'autoOpen'=>false,
//		'modal'=>true,
//		'width'=>750,
//	),
//));
?>

<?php $this->widget('MyGridView', array(
	'id'=>'payment-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'payment_date',
		array(
			'name'=>'payment_sum',
			'htmlOptions'=>array('class'=>'sum','id'=>'payment'),
			'footer'=>$model->getTotals()->payment_sum,			//'footer'=>$provider->itemCount===0 ? '' : $model->getTotals(),
			'footerHtmlOptions'=>array('class'=>'total2','id'=>'payment'),
		),
		'faktura_number',
		array(
			'name'=>'is_prepayment',
			'value'=>'$data->is_prepayment?$data->prepayment_date:""',
			'filter'=>Lookup::items('Boolean'),
			'htmlOptions'=>array('class'=>'red'),
		),
		array(
			'name'=>'admin_id',
			'value'=>'$data->admin->username',
		),
		'comment',
		array(
			'name'=>'is_active',
			'filter'=>Lookup::items('Boolean'),
		),
		array(
			'class'=>'CButtonColumn',
			//'template'=>'{view} {update}',
			'viewButtonUrl'=>'Yii::app()->createUrl("admin/payment/view",array("id"=>$data->primaryKey))', 
			'updateButtonUrl'=>'Yii::app()->createUrl("admin/payment/update",array("id"=>$data->primaryKey))',
			'deleteButtonUrl'=>'Yii::app()->createUrl("admin/payment/delete",array("id"=>$data->primaryKey))',
		),
	),
)); ?>